/*    */ package com.wgcloud.util;
/*    */ 
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import org.springframework.ui.Model;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class PageUtil
/*    */ {
/*    */   public static void initPageNumber(PageInfo pageInfo, Model model) {
/* 22 */     List<String> pageNumbers = new ArrayList<>();
/* 23 */     if (pageInfo.getPages() >= 10 && pageInfo.getPageNum() <= 5) {
/* 24 */       for (int i = 0; i < 10; i++)
/* 25 */         pageNumbers.add((1 + i) + ""); 
/*    */     } else {
/*    */       int i;
/* 28 */       for (i = 5; i > 0; i--) {
/* 29 */         if (pageInfo.getPageNum() - i > 0) {
/* 30 */           pageNumbers.add((pageInfo.getPageNum() - i) + "");
/*    */         }
/*    */       } 
/* 33 */       for (i = 0; i < 5; i++) {
/* 34 */         if (pageInfo.getPageNum() + i <= pageInfo.getPages()) {
/* 35 */           pageNumbers.add((pageInfo.getPageNum() + i) + "");
/*    */         }
/*    */       } 
/*    */     } 
/* 39 */     model.addAttribute("pageNumbers", pageNumbers);
/*    */   }
/*    */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/util/PageUtil.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */